﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TreeSharp;

namespace FelMaster.Classes.Warlock
{
    class Affliction : TalentBase
    {
        public override string Name
        {
            get { return "Cowdude's Affliction priority list"; }
        }

        public override string KeySpell
        {
            get { return "Unstable Affliction"; }
        }

        public override Composite SingleRotation
        {
            get {
                return new PrioritySelector(
                    SC.CastSpell("Life Tap", a => Me.ManaPercent < 20, "Life tap - mana < 20%"),
                    SC.CastDebuff("Curse of the Elements", a => Me.CurrentTarget.HealthPercent > 70, "CoE"),
                    SC.CastUniqueSpell("Summon Felhunter", a => (Pet == null || Pet.Dead) && (SC.PlayerHasBuff("Demonic Rebirth") || SC.PlayerHasBuff("Soulburn")), "Summon new Felhunter"),
                    SC.CastSpell("Demon Soul", a => !Me.IsMoving, "Demon Soul while not moving"),
                    SC.CastDebuff("Corruption", a => true, "Corruption"),
                    SC.CastDebuff("Unstable Affliction", a => true, "Unstable affliction"),
                    SC.CastDebuff("Bane of Doom", a => Me.CurrentTarget.CurrentHealth > 100000 || Me.CurrentTarget.Name.Contains("Dummy"), "Bane of Doom"),
                    SC.CastSpell("Haunt", a => true, "Haunt"),
                    SC.CastSpell("Summon Doomguard", a => true, "Doomguard"),
                    SC.ChannelSpell("Drain Soul", a => Me.CurrentTarget.HealthPercent <= 25, "Drain soul"),
                    //SC.CastSpell("Soulburn", a => !SC.PlayerHasBuff("Demon Soul"), "Soulburn"),
                    //SC.CastSpell("Soul Fire", a => SC.PlayerHasBuff("Soulburn"), "SF on soulburn"),
                    SC.CastSpell("Shadow Bolt", a => true, "Shadow Bolt"),
                    SC.CastSpell("Life Tap", a => Me.IsMoving && Me.HealthPercent > Me.ManaPercent && Me.ManaPercent < 80, "Life tap while moving"),
                    SC.CastSpell("Fel Flame", a => Me.IsMoving, "Fel flame while moving")
                );
            }
        }

        public override Composite Buffs
        {
            get
            {
                return new PrioritySelector(
                    //buffs
                    SC.CastBuff("Fel Armor", a => true, "Fel Armor"),
                    SC.CastUniqueSpell("Summon Felhunter", a => !Me.Combat && !Me.Mounted && Pet == null || Pet.Dead, "Summon new Felhunter"),
                    SC.CastBuff("Soul Link", a => Pet != null && Pet.IsAlive, "Soul Link")
                );
            }
        }

        public override Composite PVPRotation
        {
            get { throw new NotImplementedException(); }
        }

        public override Composite PVERotation
        {
            get
            {
                return SingleRotation;
            }
        }
    }
}
